from datetime import datetime

class Information:
	def __init__(self, info_id: int, title: str, content: str, author: str, created_at: datetime = None, updated_at: datetime = None, is_public: bool = True):
		self.info_id = info_id
		self.title = title
		self.content = content
		self.author = author
		self.created_at = created_at or datetime.now()
		self.updated_at = updated_at or self.created_at
		self.is_public = is_public

	def update_content(self, new_content: str):
		self.content = new_content
		self.updated_at = datetime.now()

	def to_dict(self) -> dict:
		return {
			'info_id': self.info_id,
			'title': self.title,
			'content': self.content,
			'author': self.author,
			'created_at': self.created_at.isoformat(),
			'updated_at': self.updated_at.isoformat(),
			'is_public': self.is_public
		}
